package pl.prv.polanie.client.widgets.schedule.custom;

import pl.prv.polanie.client.model.CacheService;
import pl.prv.polanie.client.model.ContextSettings;
import pl.prv.polanie.client.widgets.CustomDialogBox;

import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;

public class CacheDebugPanel extends CustomDialogBox {
	
	ICache cache = null;
	
	FlexTable mainFT = new FlexTable();
	
	public CacheDebugPanel(ICache cache) {
		this.cache = cache;

		setWidget(mainFT);
		mainFT.setBorderWidth(1);
		
		addRow("Lecturers", cache.getLecturersCount());
		addRow("Academic Titles", cache.getAcademicTitlesCount());
		addRow("Subgroups", cache.getSubgroupsCount());
		addRow("Groups", cache.getGroupsCount());
		addRow("Rooms", cache.getRoomsCount());
		
		addRow("---", "---");
		
		
		addRow("ContextSettings.getSemesterID", ContextSettings.getSemesterID());
//		Academic Titles 
//		Buildings 
//		Preference Types 
//		Room Types 
//		Subject Types 
//		Subgroup types 
//		Year Group Names 
//
//		 
//		Subject Names 
//		Subjects 
//
//		 
//		Lecturers 
//		Rooms 
//		Calendar Days 
//		Semester Year Groups 
//		Groups 

	}
	
	private void addRow(String label, int number) {
		addRow(label, "" + number);
	}
	
	private void addRow(String label, long number) {
		addRow(label, "" + number);
	}
	
	private void addRow(String label, String data) {
		int row = mainFT.getRowCount();
		mainFT.setWidget(row, 0 , new Label(label));
		mainFT.setWidget(row, 1 , new Label(data));
	}
}
